package org.shj.spring.boot.base;

import com.querydsl.jpa.impl.JPAQueryFactory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@NoRepositoryBean
public interface BaseDao<E extends BaseEntity, PK extends Serializable> extends JpaRepository<E, PK>,
        JpaSpecificationExecutor<E>,
        QueryDslPredicateExecutor<E> {

    JPAQueryFactory queryFactory();

    List<E> selectByNativeSql(String sql);

    List<E> selectByHql(String hql, Map<String, ?> params);

    @Override
    E findOne(PK pk);
}
